//
//  LoginViewController.m
//  New
//
//  Created by 才诗琦 on 16/1/25.
//  Copyright © 2016年 www.lanou3g.com. All rights reserved.
//

#import "LoginViewController.h"
#import "LgVC.h"
@interface LoginViewController ()<UITableViewDataSource, UITableViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate>
@property(nonatomic, retain)UITableView *tableView;
@property(nonatomic, retain)NSMutableArray *dataArr;
@property(nonatomic, retain)UIImageView *userImage;//图片名
@property(nonatomic, retain)NSString *imgPath;//图片路径
@end

@implementation LoginViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    
    if (self) {
        [self createTableView];
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.view.backgroundColor = [UIColor redColor];
   
    
    
    
    

    [self.tableView addSubview:self.userImage];
    
}

- (void)change
{
    
   
    
}


- (void)createTableView
{
    self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
    self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 180)];
//    self.tableView.tableHeaderView.backgroundColor = [UIColor redColor];
    self.dataArr = [@[@"我的收藏", @"清除缓存", @"夜间模式", @"分享"] mutableCopy];
    [self.view addSubview:_tableView];
   //用户头像
    UIImageView *userImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 20, 100, 100)];
    userImage.layer.cornerRadius = 50;
    userImage.clipsToBounds = YES;
    userImage.center = CGPointMake(self.view.center.x, userImage.center.y);
    [userImage setImage:[UIImage imageNamed:@"icon-1"]];
   [self.tableView addSubview:userImage];
    
    UIButton *qq = [UIButton buttonWithType:UIButtonTypeCustom];
    qq.frame = CGRectMake(20, 30, 30, 30);
    [qq setBackgroundImage:[UIImage imageNamed:@"qq"] forState:UIControlStateNormal];
    [qq addTarget:self action:@selector(qqClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.tableView addSubview:qq];
    
    UIButton *weixin = [UIButton buttonWithType:UIButtonTypeCustom];
    weixin.frame = CGRectMake(60, 60, 30, 30);
    [weixin setBackgroundImage:[UIImage imageNamed:@"weixin"] forState:UIControlStateNormal];
    [weixin addTarget:self action:@selector(weixinClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.tableView addSubview:weixin];
    
    UIButton *weibo = [UIButton buttonWithType:UIButtonTypeCustom];
    weibo.frame = CGRectMake(100, 100, 30, 30);
    [weibo setBackgroundImage:[UIImage imageNamed:@"weibo"] forState:UIControlStateNormal];
    
    [weibo addTarget:self action:@selector(weiboClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.tableView addSubview:weibo];
    
    
    
    
//    注册cell
    
    [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
    
    
   }

- (void)qqClick:(UIButton *)qq
{
    LgVC *log = [[LgVC alloc] init];
    [self presentViewController:log animated:YES completion:^{
        
    }];
}


- (void)weixinClick:(UIButton *)weixin
{
    
}

- (void)weiboClick:(UIButton *)weibo
{
    
}







///cell设置
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    
    return _dataArr.count;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    
    cell.textLabel.text = _dataArr[indexPath.row];
    return cell;
    
    
}

- (void)loginClick:(UIButton *)ba
{
   
}
- (void)regClick:(UIButton *)bt
{
    
    
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
